<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php 
	$USER = getAccountUserObject();
	$ESCORT = $this->escort_entity->init('user_id',$USER->getId());	
	$iCount = 0;
	$totalPeriodDiscount = $totalPromoDiscount = $totalPrice = 0;
?>
<style>
	
</style>

<script type="text/javascript">
	
</script>

<form action="<?php echo site_url('escorts/transaction_submit/submit_payment');?>" name="submit_payment" id="submit_payment" method="post" enctype="multipart/form-data" >

	<div id="content-left">
		<div id="personal-tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
			<div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<!-- content -->	
					
					<div class="dashboard-info-wrapper">
						<div class="select-box">
								<table width="100%">
									<thead>
										<th><?php echo language_translate('services_page_table_head_servicename');?></th>
										<th><?php echo language_translate('services_page_table_head_details');?></th>
										<th><?php echo language_translate('services_page_table_head_period');?></th>
										<th style="text-align:right;"><?php echo language_translate('services_page_table_head_priceeuro');?></th>
									</thead>
									<tbody>
										<?php if(isset($_SESSION['SERVICES_INFO']['SUBS'])):?>
											<tr>
												<?php 
													$subs_array = getSubcriptionData_ioc($_SESSION['SERVICES_INFO']['SUBS']['type_id']);
													$iCount++;
													$totalPeriodDiscount += $_SESSION['SERVICES_INFO']['SUBS']['period_discount_price'];
													$totalPromoDiscount += $_SESSION['SERVICES_INFO']['SUBS']['promo_discount_price'];
													$totalPrice += $_SESSION['SERVICES_INFO']['SUBS']['payment_price'];
												?>
												<td><?php echo language_translate('services_page_subscription');?></td>
												<td><?php echo $subs_array[0];?></td>
												<td><?php echo $_SESSION['SERVICES_INFO']['SUBS']['period'];?></td>
												<td style="text-align:right;"><?php echo euroCurrencyFormat( currencyDisplay( $_SESSION['SERVICES_INFO']['SUBS']['payment_price'] ) );?></td>
											</tr>
										<?php endif;?>
										
										<?php if(isset($_SESSION['SERVICES_INFO']['PLACE'])):?>
											<?php
												foreach($_SESSION['SERVICES_INFO']['PLACE'] as $k =>$v):
													$placeInfo = getPlaceListDataInfoById($v['type_id']);
											?>
											<?php if($placeInfo):?>
												<?php 
													$iCount++;
													$totalPeriodDiscount += $v['period_discount_price'];
													$totalPromoDiscount += $v['promo_discount_price'];
													$totalPrice += $v['payment_price'];
												?>
												<tr>
													<td><?php echo language_translate('services_page_where_do_you_work');?></td>
													<td>
														<?php echo $placeInfo['country'];?>
														<?php if($placeInfo['state']):?>
															/
															<?php echo $placeInfo['state'];?>
														<?php endif;?>
														<?php if($placeInfo['province']):?>
															/
															<?php echo $placeInfo['province'];?>
														<?php endif;?>
														<?php if($placeInfo['city']):?>
															/
															<?php echo $placeInfo['city'];?>
														<?php endif;?>
													</td>
													<td>
														<?php echo $v['period'];?>
													</td>
													<td style="text-align:right;"><?php echo euroCurrencyFormat( currencyDisplay( $v['payment_price'] ) );?></td>
												</tr>
											<?php endif;?>
											<?php endforeach; ?>
										<?php endif;?> 
										
										<?php if(isset($_SESSION['SERVICES_INFO']['PACK'])):?>
											<?php foreach($_SESSION['SERVICES_INFO']['PACK'] as $k => $v):?>
													<?php 
														$pack_array = getPackListData_ioc($v['type_id']);
														$iCount++;
														$totalPeriodDiscount += $v['period_discount_price'];
														$totalPromoDiscount += $v['promo_discount_price'];
														$totalPrice += $v['payment_price'];
													?>
													<tr>
														<td><?php echo language_translate('services_page_add_a_pack');?></td>
														<td>
															<?php echo $pack_array[0];?>
														</td>
														<td>
															<?php echo $v['period'];?>
														</td>
														<td style="text-align:right;"><?php echo euroCurrencyFormat( currencyDisplay( $v['payment_price'] ) );?></td>
													</tr>
											<?php endforeach; ?>
										<?php endif;?> 
										
										<?php if(isset($_SESSION['SERVICES_INFO']['PRI'])):?>
											<?php foreach($_SESSION['SERVICES_INFO']['PRI'] as $k=>$v):?>
												<?php 
													$pri_array = getPriorityData_ioc($v['type_id']);
													$iCount++;
													$totalPeriodDiscount += $v['period_discount_price'];
													$totalPromoDiscount += $v['promo_discount_price'];
													$totalPrice += $v['payment_price'];
												?>
												<tr>
													<td><?php echo language_translate('services_page_priority');?></td>
													<td>
														<?php echo $pri_array[0];?>
													</td>
													<td>
														<?php echo $v['period'];?>
													</td>
													<td style="text-align:right;"><?php echo euroCurrencyFormat( currencyDisplay( $v['payment_price'] ) );?></td>
												</tr>
											<?php endforeach; ?>
										<?php endif;?> 
										
										<?php if(isset($_SESSION['SERVICES_INFO']['NET_AMOUNT'])):?>
											<tr>
												<td colspan=3></td>
												<td style="text-align:right;"><?php echo euroCurrencyFormat( currencyDisplay( $totalPrice ) );?></td>
											</tr>
										<?php endif;?>
									</tbody>
								</table>
						 </div>
						<div class="clear"></div>
					</div>
					
					<?php if($iCount):?>			
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-left"><span><?php echo language_translate('services_page_your_promotion_code');?></span></div>
							<div class="dashboard-info-right">
								<div class="select-box">
									<span id="promotion-info">
									<?php if($_SESSION['SERVICES_INFO']['DISCOUNT_PROMO_CODE']):?>
										<?php echo $_SESSION['SERVICES_INFO']['DISCOUNT_PROMO_CODE'];?>
											|	
										<?php echo $_SESSION['SERVICES_INFO']['DISCOUNT_PROMO_INFO'];?>
									<?php endif;?>	
									</span>
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-left"><span><?php echo language_translate('services_page_promo_discount');?></span></div>
							<div class="dashboard-info-right">
								<div class="select-box">
									<?php echo euroCurrencyFormat( currencyDisplay($totalPromoDiscount) );?> &euro;
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-left"><span><?php echo language_translate('services_page_total_period_discount');?></span></div>
							<div class="dashboard-info-right">
								<div class="select-box">
									<?php echo euroCurrencyFormat( currencyDisplay($totalPeriodDiscount) );?> &euro;
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-left"><span><?php echo language_translate('services_page_net_amount');?></span></div>
							<div class="dashboard-info-right">
								<div class="select-box">
									<span id="net_amount_price">
										<?php if(isset($_SESSION['SERVICES_INFO']['NET_AMOUNT'])):?>
											<?php echo euroCurrencyFormat( currencyDisplay( $_SESSION['SERVICES_INFO']['NET_AMOUNT']) );?> &euro;
										<?php endif;?>
									</span>									
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-left"><span><?php echo language_translate('contract_start_date');?></span></div>
							<div class="dashboard-info-right">
								<div class="select-box">
									<?php echo sysDateFormat($_SESSION['SERVICES_INFO']['STARTDATE'],DATE_FORMAT);?>
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-left"><span><?php echo language_translate('contract_to_date');?></span></div>
							<div class="dashboard-info-right">
								<div class="select-box">
									<?php echo sysDateFormat($_SESSION['SERVICES_INFO']['ENDDATE'],DATE_FORMAT);?>
								</div>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						
					<?php endif;?>
					
					<div class="dashboard-info-wrapper">
						<?php 
							$records = $this->escort_news_entity->getNewsByCategoryName('Payment Info');
						?>
						<?php foreach($records as $item):?>		
							<div class="news-content">
								<?php echo $item->news;?>
							</div>
						<?php endforeach;?>
					</div>
						
					<?php if($iCount):?>
					<!-- 
						<div class="dashboard-info-wrapper">
							<div class="dashboard-info-right">
								<input type="submit" class="save-button" value="<?php //echo language_translate('services_page_pay');?>" /> 
								<?php //echo loader_image("id='loader_image' class='hidden'");?>
							</div>
							<div class="clear"></div>
						</div>
					 -->		 
					<?php endif;?>
					
					<div class="dashboard-info-wrapper">
						<div id="update-message"><?php echo language_translate('update_successfully_message');?></div>
						<div class="clear"></div>
					</div>
	
				<!-- end content -->
			</div>
		</div>
	</div>

</form>

<?php $this->load->view('escorts/right_nav'); ?>



<script type="text/javascript">
	$(document).ready(function() { 
		
	});	

	$(document).ready(function() {
		var options = { 
			beforeSubmit:  validateB4Submit,  
			success:       processAfterResponding   
		};	
		$('#submit_payment').ajaxForm(options); 
	});	

	function validateB4Submit(formData, jqForm, options){
		$('#loader_image').show();
		return true;
	}

	function processAfterResponding(responseText, statusText, xhr, $form) {
		$('#loader_image').hide();	
		if(responseText == 'ok'){
			updatedShow();
		}else{
			debug(responseText);
		}
	}
	
</script>